-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix zhack label repair
checksum repair regression on nonzero TXG
#17732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Using the |
837c4f6
to
b88bfe7
Compare
b88bfe7
to
799ad38
Compare
This commit fixes a likely regression introduced by 64db435 where the checksum repair functionality (`-c` or default behavior) will perform checks and access data associated with the newer undetach (`-u`) functionality, resulting in a failure when an uberblock's TXG is not 0 as required by `-u` but not `-c` Additionally, code is refactored for better separation of tasks. Signed-off-by: buzzingwires <[email protected]>
799ad38
to
2e6a017
Compare
Thank you for the review. Question about the shell dialect: Should I generally assume |
Yes, for historical reasons the test suite is almost all in ksh93. Using |
Totally understand. Just wanted to know what I was working with. I certainly will, then. Would you prefer on this PR? |
Sure, including it in this PR would be fine. Please just keep that change separate as its own commit. |
As a quality assurance measure, `typeset` is added to local variable declarations to actually enforce their intended scope. Signed-off-by: buzzingwires <[email protected]>
As a quality assurance measure, `typeset` is added to local variable declarations to actually enforce their intended scope. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: buzzingwires <[email protected]> Closes #17732
This commit fixes a likely regression introduced by 64db435 where the checksum repair functionality (`-c` or default behavior) will perform checks and access data associated with the newer undetach (`-u`) functionality, resulting in a failure when an uberblock's TXG is not 0 as required by `-u` but not `-c` Additionally, code is refactored for better separation of tasks. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: buzzingwires <[email protected]> Closes openzfs#17732
As a quality assurance measure, `typeset` is added to local variable declarations to actually enforce their intended scope. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: buzzingwires <[email protected]> Closes openzfs#17732
Motivation and Context
This change is intended to fix a regression introduced by 64db435 and first noticed when reviewing these error messages.
The aforementioned commit aimed to maintain the
zhack label repair
behavior of d04b5c9 by default, but performed checks and unnecessarily accessed data associated with the new-u
(undetach) instruction when doing so.This caused the old checksum repair behavior (default or
-c
) to fail when an uberblock with a nonzero TXG was encountered, when this behavior was only intended for-u
.The issue was not caught by old tests because there are so few transactions made on a testing zpool that some uberblocks are never assigned a TXG.
Description
The check for an uberblock's TXG being zero is now only performed for the
-u
option, which assumes a clean detach.The ashift value is only accessed when needed by the
-u
option.Determining whether to do byteswap for checksum calculation fails if the magic number doesn't match the expected for either endianness, rather than only if the magic number is zero.
Code is refactored to better separate it into discrete tasks and track return values.
In a separate commit,
typeset
s are added to local variable declarations in test scripts to enforce their scope.How Has This Been Tested?
Case one (
zhack_label_repair_001.ksh
) of the relevant tests has been revised to do the following128256 times:touch
the test data stored in the pool, then callzpool sync
on the pool. This ensures there are enough updates for every uberblock to be used, so that the checksum repair will encounter a nonzero TXG. Documentation for these tests is updated accordingly.Types of changes
Checklist:
Signed-off-by
.